package ext.tianma.bom.workflow;

import java.rmi.RemoteException;

import wt.part.WTPart;
import wt.util.WTException;

import com.ptc.core.components.descriptor.ModelContext;
import com.ptc.core.components.factory.AbstractDataUtility;

import ext.com.iba.IBAUtil;

public class SampleApproveDataUtility extends AbstractDataUtility {
	
	@Override
	public Object getDataValue(String param , Object object, ModelContext modelContext) throws WTException {
		
		System.out.println("param = " + param ) ;
		
		Object obj = null ;
		
		if ( object != null && object instanceof WTPart ) {
			WTPart part = ( WTPart ) object ;
			
			if(param != null && param.equals("partRecognize")){
				try {
					obj =IBAUtil.getIBAValue( part , "partRecognize" ) ;
				} catch (RemoteException e) {
					e.printStackTrace();
				}
			}else{
				obj = "" ;
			}
		}else{		
			if(object != null){
				System.out.println("Object type is " + object.getClass()) ;
			}else{
				System.out.println("Object is NULL!") ;
			}
		}
		
		if( obj == null ){
			obj = "" ;
		}
		
		return obj;
	}
}
